Areas of a streambuf

Contents|Index|Previous|Next
Areas of a streambuf

streambuf buffer management is fairly sophisticated (or complicated).

The standard protocol has the following areas.

- The put area contains characters waiting for output.
- The get area contains characters available for reading.

The following methods are used to manipulate these areas. These are all protected methods, intended to be used by virtual function in classes derived from streambuf. They are also all ANSI/ISO-standard, and the ugly names are traditional.

Note:

If a pointer points to the ‘end’ of an area, it means that it points to the character after the area.

char* streambuf::pbase ()const
Method

Returns a pointer to the start of the put area.

char* streambuf::epptr ()const
Method

Returns a pointer to the end of the put area.

char* streambuf::pptr ()const
Method

If pptr() < epptr (), the pptr() returns a pointer to the current put position. (In that case, the next write will overwrite *pptr(), and increment pptr().) Otherwise, there is no put position available (and the next character written will cause streambuf::overflow to be called).

void streambuf::pbump (int N)
Method

Add N to the current put pointer. No error checking is done.

void streambuf::setp (char* P, char* E)
Method

Sets the start of the put area to P, the end of the put area to E, and the current put pointer to P (also).

char* streambuf::eback ()const
Method

Returns a pointer to the start of the get area.

char* streambuf::egptr ()const
Method

Returns a pointer to the end of the get area.

char* streambuf::gptr ()const
Method

If gptr() < egptr (), then gptr() returns a pointer to the current get position. (In that case the next read will read *gptr(), and possibly increment gptr().) Otherwise, there is no read position available (and the next read will cause streambuf::underflow to be called).

void streambuf:gbump (int N)
Method

Add N to the current get pointer. No error checking is done.

void streambuf::setg (char* B, char* P, char* E)
Method

Sets the start of the get area to B, the end of the get area to E, and the current put pointer to P.

Top|Contents|Index|Previous|Next